﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace DBLibrary.Model.pojo
{
    public class LogicAlarm : INotifyPropertyChanged   //逻辑报警表
    {
        private int _Id;                      // Id
        private int _isValid;                 //有效否
        private string _ProjectName;          // 项目名称
        private int _conditional1Isvalid;     // 条件1有效否
        private string _Sensor1;              //传感器1
        private string _conditional1;         // 条件1
        private string _value1;               //数值1
        private double _duration1;               //时长1
        private int _conditional2Isvalid;     // 条件1有效否
        private string _Sensor2;              //传感器1
        private string _conditional2;         // 条件1
        private string _value2;               //数值1
        private double _duration2;               //时长1
        private int _conditional3Isvalid;     // 条件1有效否
        private string _Sensor3;              //传感器1
        private string _conditional3;         // 条件1
        private string _value3;               //数值1
        private int _duration3;               //时长1
        private int _conditional4Isvalid;     // 条件1有效否
        private string _Sensor4;              //传感器1
        private string _conditional4;         // 条件1
        private string _value4;               //数值1
        private int _duration4;               //时长1
        private int _conditional5Isvalid;     //条件1有效否
        private string _Sensor5;              //传感器1
        private string _conditional5;         //条件1
        private string _value5;               //数值1
        private int _duration5;               //时长5
        private string _openRelate;           //开出关联
        private string _offpowerArea;         //断电区域

        private int _isEmergencyResponse;     //是否应急联动

        private string _personLocation;       //人员定位
        private string _voiceCast;            //语音广播

        private string _phone;                //电话号码
        private string _status;               //状态
        private DateTime? _time;               //时间
        private int _type;                    //类型
        private int _condition1;              //条件1或
        private int _condition2;              
        private int _condition3;
        private int _condition4;
        private int _condition5;
        string conditionName1;
        string conditionName2;
        string conditionName3;
        string conditionName4;
        string conditionName5;
        public object MemberCopy()
        {
            return this.MemberwiseClone();
        }
        public int Id { get => _Id; set => _Id = value; }
        public int IsValid { get => _isValid;
            set {
                _isValid = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string ProjectName { get => _ProjectName==null?"": _ProjectName ;
            set
            {
                _ProjectName = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Conditional1Isvalid { get => _conditional1Isvalid;
            set
            {
                _conditional1Isvalid = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Sensor1 { get => _Sensor1 == null ? "" : _Sensor1;
            set
            {
                _Sensor1 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Conditional1 { get => _conditional1 == null ? "" : _conditional1;
            set
            {
                _conditional1 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Value1 { get => _value1 == null ? "" : _value1;
            set
            {
                _value1 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public double Duration1 { get => _duration1;
            set
            {
                _duration1 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Conditional2Isvalid { get => _conditional2Isvalid;
            set
            {
                _conditional2Isvalid = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Sensor2 { get => _Sensor2 == null ? "" : _Sensor2; 
            set
            {
                _Sensor2 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Conditional2 { get => _conditional2 == null ? "" : _conditional2;
            set
            {
                _conditional2 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Value2 { get => _value2 == null ? "" : _value2;
            set
            {
                _value2 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public double Duration2 { get => _duration2;
            set
            {
                _duration2 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Conditional3Isvalid { get => _conditional3Isvalid;
            set
            {
                _conditional3Isvalid = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Sensor3 { get => _Sensor3 == null ? "" : _Sensor3;
            set
            {
                _Sensor3 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Conditional3 { get => _conditional3 == null ? "" : _conditional3;
            set
            {
                _conditional3 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Value3 { get => _value3 == null ? "" : _value3;
            set
            {
                _value3 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Duration3 { get => _duration3;
            set
            {
                _duration3 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Conditional4Isvalid { get => _conditional4Isvalid;
            set
            {
                _conditional4Isvalid = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Sensor4 { get => _Sensor4 == null ? "" : _Sensor4;
            set
            {
                _Sensor4 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Conditional4 { get => _conditional4 == null ? "" : _conditional4;
            set
            {
                _conditional4 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Value4 { get => _value4 == null ? "" : _value4;
            set
            {
                _value4 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Duration4 { get => _duration4;
            set
            {
                _duration4 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Conditional5Isvalid { get => _conditional5Isvalid;
            set
            {
                _conditional5Isvalid = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Sensor5 { get => _Sensor5 == null ? "" : _Sensor5;
            set
            {
                _Sensor5 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Conditional5 { get => _conditional5 == null ? "" : _conditional5;
            set
            {
                _conditional5 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Value5 { get => _value5 == null ? "" : _value5;
            set
            {
                _value5 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Duration5 { get => _duration5;
            set
            {
                _duration5 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string OpenRelate { get => _openRelate == null ? "" : _openRelate;
            set
            {
                _openRelate = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string OffpowerArea { get => _offpowerArea == null ? "" : _offpowerArea;
            set
            {
                _offpowerArea = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string PersonLocation { get => _personLocation == null ? "" : _personLocation;
            set
            {
                _personLocation = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string VoiceCast { get => _voiceCast == null ? "" : _voiceCast;
            set
            {
                _voiceCast = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int IsEmergencyResponse { get => _isEmergencyResponse;
            set
            {
                _isEmergencyResponse = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Phone { get => _phone == null ? "" : _phone;
            set
            {
                _phone = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string Status { get => _status == null ? "" : _status;
            set
            {
                _status = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public DateTime? Time { get => _time != null ? _time : new Nullable<DateTime>();
            set
            {
                _time = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Type { get => _type;
            set
            {
                _type = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Condition1 { get => _condition1;
            set
            {
                _condition1 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Condition2 { get => _condition2;
            set
            {
                _condition2 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Condition3 { get => _condition3;
            set
            {
                _condition3 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Condition4 { get => _condition4;
            set
            {
                _condition4 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public int Condition5 { get => _condition5;
            set
            {
                _condition5 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string ConditionName1 { get => Sensor1+" "+Condition1;
            set
            {
                Sensor1 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string ConditionName2 { get => Sensor2 + " " + Condition2;
            set
            {
                Sensor2 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string ConditionName3 { get => Sensor3+ " " + Condition3;
            set
            {
                Sensor3 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string ConditionName4 { get => Sensor4 + " " + Condition4;
            set
            {
                Sensor4 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }
        public string ConditionName5 { get => Sensor5 + " " + Condition5;
            set
            {
                Sensor5 = value;
                if (PropertyChanged != null)
                {
                    NotifyPropertyChanged();
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
